package com.qqserver.service;

import com.qqcommon.Message;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;
import java.util.TreeMap;

public class ClientConnectServerThread extends Thread{
    private Socket socket;



    //构造器可以接受一个Socket对象
    public ClientConnectServerThread(Socket socket){
        this.socket=socket;
    }


    @Override
    public void run() {
        //因为Thread需要在后台和服务器通信,所有用while循环
        while(true){
            try {
                System.out.println("客户端线程,等待读取从服务器中发来的消息");
                ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
                Message message=(Message) ois.readObject();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }


    }
}
